package com.xlh.wjdcserver.handler;

import com.common.exception.FileException;
import com.common.exception.QuestionnaireException;
import com.common.exception.UserException;
import com.common.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler{

    @ExceptionHandler(UserException.class)
    public Result userExceptionHandler(UserException e) {
        return Result.error(e.getMessage());
    }

    @ExceptionHandler(QuestionnaireException.class)
    public Result QuestionnaireExceptionHandler(QuestionnaireException e) {
        return Result.error(e.getMessage());
    }

    @ExceptionHandler(FileException.class)
    public Result FileExceptionHandler(FileException e) {
        return Result.error(e.getMessage());
    }

}
